/********************************Copyright (c)**********************************\
**
**                   (c) Copyright 2021, Main, China, QD.
**                           All Rights Reserved
**
**                                By(wo4fisher)
**                           http://www.wo4fisher.com
**
**----------------------------------文件信息------------------------------------
** 文件名称: key.h
** 创建人员: wht
** 创建日期: 2021-06-09
** 文档描述:
**
**----------------------------------版本信息------------------------------------
** 版本代号: V0.1
** 版本说明: 初始版本
**
**------------------------------------------------------------------------------
\********************************End of Head************************************/

#ifndef __KEY_H_
#define __KEY_H_
#include "common.h"
#include "STC8Axx.h"
#include "bsp_tick.h"
#include "bsp_buzzer.h"
#include "intrins.h"
#include "stdio.h"

sbit  KEY1 = P0 ^ 3;//OK SET
sbit  KEY2 = P0 ^ 4;//UP  PLUS
sbit  KEY3 = P0 ^ 5;//DOWN MINUS
sbit  KEY4 = P0 ^ 6;//RETURN BACK
sbit  KEY5 = P0 ^ 7;//RETURN BACK

enum _key_code_e_ { KEY_LEFT, KEY_RIGHT, KEY_MID, KEY_UP, KEY_DOWN, KEY_UNKNOWN, KEY_NONE};
enum  _key_type_e_ {KEY_PRESSED, KEY_REPEATED, KEY_RELEASED};

void  key_init ( void );
uint8 key_ScanKeyCode ( void );
void  key_Task ( void );
uint8 key_InsertKeyCode ( uint8 key_code, uint8 state );
uint8 key_GetKeyCode ( uint8 *pcode, uint8 *pstate );

#endif


/********************************End of File************************************/